#include"concrete_state.h"
#include"context.h"
#include<iostream>
using namespace std;
RedLight::RedLight(TrafficLights *context):m_pContext(context)
{

}

void RedLight::Handle()
{
    std::cout << "Red Light" << std::endl;
     m_pContext->SetState(new GreenLight(m_pContext));
     delete this;
}

GreenLight::GreenLight(TrafficLights *context):m_pContext(context)
{

}

void GreenLight::Handle()
{
    std::cout << "Green Light" << std::endl;
    m_pContext->SetState(new YellowLight(m_pContext));
    delete this;
}

YellowLight::YellowLight(TrafficLights *context):m_pContext(context)
{

}

void YellowLight::Handle()
{
    std::cout << "Yellow Light" << std::endl;
        m_pContext->SetState(new RedLight(m_pContext));
        delete this;
}
